package com.zh.jwt.common.util;

/**
 * 用户Id，ThreadLocal
 */
public class UserHolder {
    private static final ThreadLocal<Long> sUserThreadLocal = new ThreadLocal<>();

    /**
     * 设置用户Id
     */
    public static void setUserId(Long userId) {
        sUserThreadLocal.set(userId);
    }

    /**
     * 获取用户Id
     */
    public static Long getUserId() {
        return sUserThreadLocal.get();
    }
}
